command line Arguments


In [1]:
import sys
print('Arguments', sys.argv)


Arguments ['/Users/gaufung/anaconda/lib/python3.6/site-packages/ipykernel/__main__.py', '-f', '/Users/gaufung/Library/Jupyter/runtime/kernel-81a8c2d9-1ddf-400d-8809-efb9a497ddc8.json']

input and output streams


In [2]:
import sys

print('STATUS: Reading from stdin', file=sys.stderr)

data = sys.stdin.read()

print('STATUS: Writing data to stdout', file=sys.stderr)

sys.stdout.write(data)
sys.stdout.flush()

print('STATUS: Done', file=sys.stderr)


STATUS: Reading from stdin
STATUS: Writing data to stdout
STATUS: Done